package com.airlenet.plugin.maven;

import org.apache.maven.plugin.*;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;

import java.io.File;
import java.io.FileInputStream;
import java.util.*;
import java.util.function.Supplier;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
public abstract class AbstractPackagerMojo extends AbstractMojo {
    /**
     * The Maven project.
     * @since 1.0.0
     */
    @Parameter(defaultValue = "${project}", readonly = true, required = true)
    protected MavenProject mavenProject;

    /**
     * The Maven session.
     * @since 2.4.0
     */
    @Parameter(defaultValue = "${session}", readonly = true, required = true)
    protected MavenSession mavenSession;

    @Component
    protected BuildPluginManager pluginManager;

    /**
     * Maven project helper utils.
     * @since 1.0.0
     */
    @Component
    protected MavenProjectHelper projectHelper;

    /**
     * The name of the main class. If not specified the first compiled class found that
     * contains a {@code main} method will be used.
     * @since 1.0.0
     */
    @Parameter
    protected String mainClass;

    @Parameter(
            defaultValue = "${project.build.finalName}",
            readonly = true
    )
    protected String finalName;


    @Parameter(
            defaultValue = "${project.artifactId}",
            readonly = true
    )
    protected String appName;

    @Parameter(
            defaultValue = "${project.build.directory}",
            readonly = true
    )
    protected File outputDirectory;
    /**
     * App name.
     */
    @Parameter(defaultValue = "${project.name}", property = "name", required = false)
    protected String name;

    /**
     * App name to show.
     */
    @Parameter(defaultValue = "${project.name}", property = "displayName", required = false)
    protected String displayName;

    /**
     * Project version.
     */
    @Parameter(defaultValue = "${project.version}", property = "version", required = false)
    protected String version;

    /**
     * Project description.
     */
    @Parameter(defaultValue = "${project.description}", property = "description", required = false)
    protected String description;

    /**
     * App website URL.
     */
    @Parameter(defaultValue = "${project.url}", property = "url", required = false)
    protected String url;
    /**
     * Output directory.
     */
    @Parameter(defaultValue = "${project.build.directory}/${project.artifactId}", property = "distDirectory", required = false)
    protected File distDirectory;


}
